﻿@model ComputedModel
@using BstHelperExtensions = TotalFreedomBST
@{
    ViewBag.Title = "Computed";
}

<h2>Computed</h2>

<p>Computed observables are functions that are dependent on one or more other observables, and will automatically update whenever any of these dependencies change.</p>

<p>Because of limitations of conversion C# -&gt; JavaScript, right now we have implemented three different approaches, but none of them is perfect.</p>

<p>We are looking on other ways to achieve the goal, if you have proposals, we would really appreaciate if you share your ideas with us.</p>

@Html.VisiTogglerFromPartial(CodeSamplePartials.COMPUTED_VIEW_MODEL, Html.CreateVisiToggler("show the samples view model C# source code ", htmlAttributes: new { @class = "onright" }, options: VisiOptions.HiddenByDefault))
<br />
@Html.VisiTogglerFromPartial(CodeSamplePartials.COMPUTED_CONTROLLER, Html.CreateVisiToggler("show the samples controller C# source code ", htmlAttributes: new { @class = "onright" }, options: VisiOptions.HiddenByDefault))

<h3>Sample #1</h3>

<p>First name is: <span @Html.KoAttrText(m => m.FirstName)></span></p>
<p>Last name is: <span @Html.KoAttrText(m => m.LastName)></span></p>
<p>Full name is: <span @Html.KoAttrText(m => m.FullName)></span></p>

@Html.VisiTogglerFromPartial(CodeSamplePartials.COMPUTED1, Html.CreateVisiToggler("show the sample source code ", htmlAttributes: new { @class = "onright" }, options: VisiOptions.HiddenByDefault))

<h3>Sample #2</h3>

<p>Full name is: <span @Html.KoAttrText(m => m.FullName2)></span></p>

@Html.VisiTogglerFromPartial(CodeSamplePartials.COMPUTED2, Html.CreateVisiToggler("show the sample source code ", htmlAttributes: new { @class = "onright" }, options: VisiOptions.HiddenByDefault))

<h3>Sample #3</h3>

<p>Full name is: <span @Html.KoAttrText(m => m.FullName3)></span></p>

@Html.VisiTogglerFromPartial(CodeSamplePartials.COMPUTED3, Html.CreateVisiToggler("show the sample source code ", htmlAttributes: new { @class = "onright" }, options: VisiOptions.HiddenByDefault))

<p>More is coming soon ...</p>


<p>&nbsp;</p>
<p>Next &gt; @Html.ActionLink("Visible", "Visible", "Examples")</p>

@Model.ApplyBindingsScript(KoBindingOptions.IncludeData)